Do proper rounding of bounding box coordinates.
authorFederico Mena Quintero <federico@redhat.com>
Wed, 3 Nov 1999 20:26:32 +0000 (20:26 +0000)
committerArturo Espinosa <unammx@src.gnome.org>
Wed, 3 Nov 1999 20:26:32 +0000 (20:26 +0000)
1999-11-03  Federico Mena Quintero  <federico@redhat.com>

* src/gnome-canvas-pixbuf.c (recompute_bounding_box): Do proper
rounding of bounding box coordinates.
(gnome_canvas_pixbuf_bounds): Implemented the ::bounds() method.
(gnome_canvas_pixbuf_draw): Use the correct alpha threshold value.

gdk-pixbuf/ChangeLog
gdk-pixbuf/gnome-canvas-pixbuf.c

index c7aeccd3f238bcbf5185a602ad2b5ab2695a64a2..b74960c074f19f46a5c55ccda1a8da941ace5647 100644 (file)
@@ -1,3 +1,10 @@
+1999-11-03  Federico Mena Quintero  <federico@redhat.com>
+
+       * src/gnome-canvas-pixbuf.c (recompute_bounding_box): Do proper
+       rounding of bounding box coordinates.
+       (gnome_canvas_pixbuf_bounds): Implemented the ::bounds() method.
+       (gnome_canvas_pixbuf_draw): Use the correct alpha threshold value.
+
 1999-11-03  Jonathan Blandford  <jrb@redhat.com>
 
        * src/io-gif.c (gif_prepare_lzw): s/lwz/lzw/g
index 9c9bf9159cf9ea8d562015a56635b5d8bebe9543..57b7626d6a5a8f222b3141f48fe66300f7fe4eca 100644 (file)
@@ -578,8 +578,10 @@ recompute_bounding_box (GnomeCanvasPixbuf *gcp)
        item->x2 = MAX (max_x1, max_x2);
        item->y2 = MAX (max_y1, max_y2);
 
-       item->x2++;
-       item->y2++;
+       item->x1 = floor (item->x1);
+       item->y1 = floor (item->y1);
+       item->x2 = ceil (item->x2);
+       item->y2 = ceil (item->y2);
 }
 
 \f
@@ -708,7 +710,7 @@ gnome_canvas_pixbuf_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
                                             0, 0,
                                             width, height,
                                             GDK_PIXBUF_ALPHA_BILEVEL,
-                                            127,
+                                            128,
                                             GDK_RGB_DITHER_MAX,
                                             x, y);
 
@@ -808,5 +810,21 @@ gnome_canvas_pixbuf_bounds (GnomeCanvasItem *item, double *x1, double *y1, doubl
        gcp = GNOME_CANVAS_PIXBUF (item);
        priv = gcp->priv;
 
-       
+       *x1 = 0.0;
+       *y1 = 0.0;
+
+       if (priv->pixbuf) {
+               if (priv->width_set)
+                       *x2 = priv->width;
+               else
+                       *x2 = priv->pixbuf->art_pixbuf->width;
+
+               if (priv->height_set)
+                       *y2 = priv->height;
+               else
+                       *y2 = priv->pixbuf->art_pixbuf->height;
+       } else {
+               *x2 = 0.0;
+               *y2 = 0.0;
+       }
 }